#!/bin/bash

#ads_to_mysql.sh all/表名
#1、判断参数是否传入
if [ $# -lt 1 ]
then
    echo "必须传入all/表名..."
    exit
fi
#2、根据表名匹配导数据到mysql
case $1 in
"all")
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_age_group_trade_stats/*" /opt/module/datax/job/export/medical_report.ads_age_group_trade_stats.json
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_doctor_change_stats/*" /opt/module/datax/job/export/medical_report.ads_doctor_change_stats.json
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_gender_trade_stats/*" /opt/module/datax/job/export/medical_report.ads_gender_trade_stats.json
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_hospital_review_stats/*" /opt/module/datax/job/export/medical_report.ads_hospital_review_stats.json
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_hospital_trade_stats/*" /opt/module/datax/job/export/medical_report.ads_hospital_trade_stats.json
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_review_stats/*" /opt/module/datax/job/export/medical_report.ads_review_stats.json
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_trade_stats/*" /opt/module/datax/job/export/medical_report.ads_trade_stats.json
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_user_change_stats/*" /opt/module/datax/job/export/medical_report.ads_user_change_stats.json
    ;;
"ads_age_group_trade_stats")
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_age_group_trade_stats/*" /opt/module/datax/job/export/medical_report.ads_age_group_trade_stats.json
    ;;
"ads_doctor_change_stats")
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_doctor_change_stats/*" /opt/module/datax/job/export/medical_report.ads_doctor_change_stats.json
    ;;
"ads_gender_trade_stats")
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_gender_trade_stats/*" /opt/module/datax/job/export/medical_report.ads_gender_trade_stats.json
    ;;
"ads_hospital_review_stats")
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_hospital_review_stats/*" /opt/module/datax/job/export/medical_report.ads_hospital_review_stats.json
    ;;
"ads_hospital_trade_stats")
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_hospital_trade_stats/*" /opt/module/datax/job/export/medical_report.ads_hospital_trade_stats.json
    ;;
"ads_review_stats")
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_review_stats/*" /opt/module/datax/job/export/medical_report.ads_review_stats.json
    ;;
"ads_trade_stats")
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_trade_stats/*" /opt/module/datax/job/export/medical_report.ads_trade_stats.json
    ;;
"ads_user_change_stats")
    python /opt/module/datax/bin/datax.py -p"-Dexportdir=/warehouse/medical/ads/ads_user_change_stats/*" /opt/module/datax/job/export/medical_report.ads_user_change_stats.json
    ;;
*)
    echo "表名输入错误..."
    ;;
esac

